using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.Staff
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("Operator")]
    [Route("api/basic-archives/operator")]
    public partial class OperatorController : BasicArchivesController, IOperatorAppService
    {
        protected IOperatorAppService OperatorAppService => LazyServiceProvider.LazyGetRequiredService<IOperatorAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<OperatorDto> GetAsync(Guid id)
        {
            return OperatorAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<OperatorDto> FindAsync(string filter)
        {
            return OperatorAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<OperatorDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return OperatorAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<OperatorDto>> GetListAsync(FilterRequestDto input)
        {
            return OperatorAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<OperatorDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return OperatorAppService.QueryAsync(input);
        }

        [HttpPost]
        public Task<OperatorDto> CreateAsync(OperatorCreateDto input)
        {
            return OperatorAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<OperatorDto> UpdateAsync(Guid id, OperatorUpdateDto input)
        {
            return OperatorAppService.UpdateAsync(id, input);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return OperatorAppService.DeleteAsync(id);
        }
    }
} 